package com.cyufeng.blog.service;

import com.cyufeng.blog.dto.HotArticleDto;
import com.cyufeng.blog.repository.HotArticleRepository;
import com.cyufeng.blog.service.mapper.HotArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文章
 *
 * @author Cyufeng
 * Data:2019.01.12
 */
@Service
public class HotArticleService {
    @Autowired
    HotArticleRepository hotArticleRepository;

    HotArticleMapper hotArticleMapper = new HotArticleMapper();

    /**
     * 获得所有热门文章
     * @return
     */
    public List<HotArticleDto> getAllHotArticle(){
        return hotArticleMapper.entityTodto(hotArticleRepository.getAllArticle());
    }

    /**
     * 获得所有热门工具
     * @return
     */
    public List<HotArticleDto> getAllHotTool(){
        return hotArticleMapper.entityTodto(hotArticleRepository.getAllTool());
    }
}
